package com.walle.concurrenttest.waitnotify;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author zhangjiapeng
 * @Package com.walle.concurrenttest.waitnotify
 * @Description: ${todo}
 * @date 2019/2/14 9:50
 */
public class Producer implements Runnable {


    private Storage storage;

    public Producer(Storage storage) {
        this.storage = storage;
    }

    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {


        while (true){
            storage.add();
        }

    }
}
